/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.elcom.emocbc.cbcresponseparser.cbcresponse.getmessagestatus;

import com.elcom.emocbc.cbcresponseparser.cbcresponse.structure.CbcMessage;
import com.thoughtworks.xstream.XStream;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author GiangLT
 */
public class GetMessageStatusTest {

    public static void main(String[] args) {
        GetMessageStatusResponse getMessageStatusResponse = new GetMessageStatusResponse();
        getMessageStatusResponse.setRequest("getmessagestatus");
        getMessageStatusResponse.setStatus("SUCCESS");
        
        ReturnValue returnValue = new ReturnValue();
        returnValue.setType("list");
        getMessageStatusResponse.setReturnValue(returnValue);
        
        CbcMessageStatusResult cbcMessageStatusResultSuccess = new CbcMessageStatusResult();
        CbcMessageStatusResult cbcMessageStatusResultFailed = new CbcMessageStatusResult();
        List<CbcMessageStatusResult> cbcMessageStatusResults = new ArrayList<CbcMessageStatusResult>(2);
        cbcMessageStatusResults.add(cbcMessageStatusResultSuccess);
        cbcMessageStatusResults.add(cbcMessageStatusResultFailed);
        returnValue.setCbcMessageStatusResults(cbcMessageStatusResults);
        
        cbcMessageStatusResultSuccess.setType("COMPLETED");
        cbcMessageStatusResultSuccess.setMessageId("98765");
        StatusPerBsc statusPerBscSuccess = new StatusPerBsc();
        cbcMessageStatusResultSuccess.setStatusPerBsc(statusPerBscSuccess);
        
        CbcMessageStatusPerBsc cbcMessageStatusPerBsc1 = new CbcMessageStatusPerBsc();
        cbcMessageStatusPerBsc1.setBscId("BSC1");
        CbcMessageStatusPerBsc cbcMessageStatusPerBsc2 = new CbcMessageStatusPerBsc();
        cbcMessageStatusPerBsc2.setBscId("BSC2");
        List<CbcMessageStatusPerBsc> cbcMessageStatusPerBscsSuccess = new ArrayList<CbcMessageStatusPerBsc>();
        cbcMessageStatusPerBscsSuccess.add(cbcMessageStatusPerBsc1);
        cbcMessageStatusPerBscsSuccess.add(cbcMessageStatusPerBsc2);
        statusPerBscSuccess.setCbcMessageStatusPerBscs(cbcMessageStatusPerBscsSuccess);
        
        NumberOfBroadcastCompleteList numberOfBroadcastCompleteList = new NumberOfBroadcastCompleteList();
        cbcMessageStatusPerBsc1.setNumberOfBroadcastCompleteList(numberOfBroadcastCompleteList);
        List<BroadcastInformation> broadcastInformations = new ArrayList<BroadcastInformation>();
        BroadcastInformation broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-1");
        broadcastInformation.setNumberOfBroadcastComplete("2");
        broadcastInformations.add(broadcastInformation);
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-2");
        broadcastInformation.setNumberOfBroadcastComplete("4");
        broadcastInformations.add(broadcastInformation);
        numberOfBroadcastCompleteList.setBroadcastInformations(broadcastInformations);
        
        numberOfBroadcastCompleteList = new NumberOfBroadcastCompleteList();
        cbcMessageStatusPerBsc2.setNumberOfBroadcastCompleteList(numberOfBroadcastCompleteList);
        broadcastInformations = new ArrayList<BroadcastInformation>();
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-3");
        broadcastInformation.setNumberOfBroadcastComplete("4");
        broadcastInformations.add(broadcastInformation);
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-6");
        broadcastInformation.setNumberOfBroadcastComplete("8");
        broadcastInformations.add(broadcastInformation);
        numberOfBroadcastCompleteList.setBroadcastInformations(broadcastInformations);
       
        
        cbcMessageStatusResultFailed.setType("FAILURED");
        cbcMessageStatusResultFailed.setMessageId("98765");
        StatusPerBsc statusPerBscFailed = new StatusPerBsc();
        cbcMessageStatusResultFailed.setStatusPerBsc(statusPerBscFailed);
        
        CbcMessageStatusPerBsc cbcMessageStatusPerBsc3 = new CbcMessageStatusPerBsc();
        cbcMessageStatusPerBsc3.setBscId("BSC1");
        CbcMessageStatusPerBsc cbcMessageStatusPerBsc4 = new CbcMessageStatusPerBsc();
        cbcMessageStatusPerBsc4.setBscId("BSC2");
        List<CbcMessageStatusPerBsc> cbcMessageStatusPerBscsFailed = new ArrayList<CbcMessageStatusPerBsc>();
        cbcMessageStatusPerBscsFailed.add(cbcMessageStatusPerBsc3);
        cbcMessageStatusPerBscsFailed.add(cbcMessageStatusPerBsc4);
        statusPerBscFailed.setCbcMessageStatusPerBscs(cbcMessageStatusPerBscsFailed);
        
        broadcastInformations = new ArrayList<BroadcastInformation>();
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-9");
        broadcastInformation.setCause("Cell Broadcast Not Operational");
        broadcastInformations.add(broadcastInformation);
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-6");
        broadcastInformation.setCause("Unknown");
        broadcastInformations.add(broadcastInformation);
        cbcMessageStatusPerBsc3.setBroadcastInformations(broadcastInformations);
        
        broadcastInformations = new ArrayList<BroadcastInformation>();
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-8");
        broadcastInformation.setCause("Cell Broadcast Not Operational");
        broadcastInformations.add(broadcastInformation);
        broadcastInformation = new BroadcastInformation();
        broadcastInformation.setCellId("cell-7");
        broadcastInformation.setCause("Unknown");
        broadcastInformations.add(broadcastInformation);
        cbcMessageStatusPerBsc4.setBroadcastInformations(broadcastInformations);
        
        GetMessageStatusResponseParser parser = new GetMessageStatusResponseParser();
        String xml = parser.marshall(getMessageStatusResponse);
        System.out.println(xml);
        System.out.println("" + parser.unmarshall(xml));
    }
}
